package com.woniu.service.impl;

import com.woniu.controller.PaidOrderController;
import com.woniu.dao.PaidOrderDao;
import com.woniu.entity.CustomFeed;
import com.woniu.entity.PaidOrderEntity;
import com.woniu.service.PaidOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PaidOrderServiceImpl implements PaidOrderService {
    @Autowired
    PaidOrderDao paidOrderDao;
    @Override
    public List<PaidOrderEntity> listPaidOrder(PaidOrderEntity paidOrderEntity) {
        List<PaidOrderEntity> listPaidOrder = paidOrderDao.listPaidOrder(paidOrderEntity);
        for (PaidOrderEntity paidOrder:listPaidOrder) {
            //获取订单状态编号
            String apllicantStatusValue = paidOrderDao.findApllicantStatusValue(paidOrder.getApplicantStatus());
            if(apllicantStatusValue!=null) {
                paidOrder.setApplicantStatusValue(apllicantStatusValue);
            }else {
                paidOrder.setApplicantStatusValue("?");
            }
            //获取负责人编号
            Integer principalId = paidOrder.getPrincipalId();
            if(principalId!=null) {
                String principal = paidOrderDao.findPrincipalById(principalId);
                paidOrder.setPrincipal(principal);
            }else {
                paidOrder.setPrincipal("待指定");
            }
            paidOrder.setSalesMan("你瞅啥");

        }
        return  listPaidOrder;
    }

    @Override
    public PaidOrderEntity findPaidOrderById(Integer paidOrderId) {
        return paidOrderDao.findPaidOrderById(paidOrderId);
    }
}
